
<div class="forum-container">

    <ul class="thumbnails">

        <li class="thumbnail span11">

            <div class="course-threads">

                <h4>
                    ${course.name}
                    <small>${course.description}</small>
                </h4>

                <g:message code="forum.threads.label" />: <span class="badge badge-info">${course.threads.size()}</span><br />
                %{--<g:message code="forum.posts.label" />: <span class="badge badge-info"><g:if test="${course.threads}">${course.threads.sum { it.posts.size() }}</g:if><g:else>0</g:else> </span>--}%

            </div>

            <div class="course-threads">

                <ul class="thumbnails">

                    <g:each in="${course.threads}" var="thread">

                        <g:set var="firstPost" value="${thread.posts.first()}" />

                        <li class="thumbnail">

                            <div class="thread span9" >

                                <h5 class="name">
                                    ${thread.name}
                                    <small>
                                        <g:message code="forum.createdby" />:  ${firstPost.user.firstname} ${firstPost.user.lastname}
                                        <g:message code="forum.labels.on" /> <g:formatDate format="dd-MM-yyyy HH:mm" date="${thread.created}"/>
                                    </small>
                                </h5>

                                <a href="${createLink(controller: 'threads', action: 'view', params: [id: thread.id])}">${firstPost.text}?</a>

                            </div>

                        </li>

                    </g:each>

                </ul>

            </div>

        </li>

    </ul>

    <a class="btn btn-info" role="button" href="<g:createLink controller="threads" action="add"/>"><g:message code="forum.thread.new" /></a>

</div>